import { apiHttp } from '/@/utils/axios';
import {commonResponse} from "/@/api/common";
//import type { commonResponse } from './common'

export interface staffBaseModel {
    cardNo: string;
    personName: string;
    cardType: string;
    eduEducation: string;
    eduMajor: string;
    eduSchool: string;
    corpName: string;
    creationTime: number;
    lastUpdate: number;
    qualTypeList: string[];
    personId?:string;
}

export interface staffCountModel {
    qualCount?:number;//   个人证书
    historyCount?:number;//	补录业绩	integer(int64)
    limitCount?:number;//		限制行为数量	integer(int64)
    profCertCount?:number;//		岗位证书数量	integer(int64)
    projectCount?:number;//		建设云业绩	integer(int64)
    regCertCount?:number;//		注册证书数量	integer(int64)
    safetyCertCount?:number;//		安管证书数量	integer(int64)
    specialCertCount?:number;//		特种证书数量	integer(int64)
    staffId?:string;//		id	string
    techCertCount?:number;//		技工证数量	integer(int64)
    titleCertCount?:number;//		职称证书数量	integer(int64)
    year?:number;//		从业年数
}

export const getStaffListApi = params => {
  return apiHttp.post({ url: '/person/personList', params });
};

export const getStaffQualApi = () => {
    return apiHttp.post({ url: '/data/staffQual' });
};

export const getStaffBaseInfoApi = personId => {
    return apiHttp.post({ url: '/person/baseInfo', params :{ personId }});
};

export const getStaffCountfoApi = personId => {
    return apiHttp.post({ url: '/person/personCount', params :{ personId }});
};

export const getPersonPrjApi = params => {
    return apiHttp.post({ url: '/person/HistoryPrj', params });
};

export const getPersonProjectApi = params => {   //参建项目(建设云数据)
    return apiHttp.post({ url: '/person/project', params });
};

export const getPersonPermitApi = params => {   //个人人员 施工许可证
    return apiHttp.post({ url: '/person/buildLicense', params });
};

export const getPersonResumeApi = params => {
    return apiHttp.post({ url: '/person/personResume', params });
};

export const getPersonCertApi = (t,personId) => {
    enum Api {
        cert = '/person/cert',   //注册
        titl = '/person/qualTitle',  //职称
        safe = '/person/qualSafety',  //安管
        spec = '/person/qualSpecial',  //特种
        tech = '/person/qualTech',  //技术
        prof = '/person/qualProf'  //岗位
    }
    return apiHttp.post({ url: Api[t], params: { personId } });
}

export const getPersonLimitApi = (t,params) => {
    enum Api {
        yes = '/person/limitBehaviour',   //生效期
        no = '/person/expireLimit',  //过期
    }
    return apiHttp.post<commonResponse>({ url: Api[t],  params }, { isTransformRequestResult: false });
}

export const getPersonCreditApi = (t,params) => {
    enum Api {
        good = '/person/goodCreditRecord',   //良好
        bad = '/person/badCreditRecord',  //不良
    }
    return apiHttp.post<commonResponse>({ url: Api[t],  params }, { isTransformRequestResult: false });
}

export const getCreditScoreApi = params => {
    return apiHttp.post({ url: '/person/creditScore', params });
};

export const getRecordApi = regId => {
    return apiHttp.post({ url: '/person/regChange', params :{ regId } });
};
